# encoding: utf-8
"""
!/usr/bin/python3
@Author: Gao Shuo
@Time: 2018/8/24 17:39 
@ReadMe:
    Input: 
    Output: 生成条状的调色盘
"""
import numpy as np
import matplotlib.pyplot as plt

from PIL import Image
import os.path
import pandas as pd
import sys
if __name__ == "__main__":
    # path = sys.argv[1]
    # dest = sys.argv[2]
    rows, cols = 256, 1
    #     颜色
    Sky = [128, 128, 128, 255]
    Building = [128, 0, 0, 255]
    Pole = [192, 192, 128, 255]
    Road_marking = [255, 69, 0, 255]
    Road = [128, 64, 128, 255]
    Pavement = [60, 40, 222, 255]
    Tree = [128, 128, 0, 255]
    SignSymbol = [192, 128, 128, 255]
    Fence = [64, 64, 128, 255]
    Car = [64, 0, 128, 255]
    Pedestrian = [64, 64, 0, 255]
    Bicyclist = [0, 128, 192, 255]
    add1 = [127,255,170, 255]
    add2 = [85,107,47, 255]
    add3 = [	255,215,0, 255]
    add4 = [	210,105,30, 255]
    add5 = [240,128,128, 255]
    Unlabelled = [0, 0, 0, 255]

    label_colours = np.array(
        [Sky, Building, Pole, Road_marking, Road, Pavement, Tree, SignSymbol, Fence, Car, Pedestrian, Bicyclist,
         add1, add2, add3, add4, add5,  Unlabelled])
    print len(label_colours)
    rgb = np.zeros((rows, cols, 4))
    r = np.zeros((rows, cols))
    g = np.zeros((rows, cols))
    b = np.zeros((rows, cols))
    a = np.zeros((rows, cols))
    for i in range(rows):
        for j in range(cols):
            if j <= 17:
                r[i, j] = label_colours[j, 0]
                g[i, j] = label_colours[j, 1]
                b[i, j] = label_colours[j, 2]
                a[i, j] = label_colours[j, 3]
    rgb[:, :, 0] = r / 255.0
    rgb[:, :, 1] = g / 255.0
    rgb[:, :, 2] = b / 255.0
    rgb[:, :, 3] = a / 255.0
    plt.imshow(rgb)
    plt.show()


